﻿using System.Collections.Generic;

public delegate void UIEvent(object[] allParams);

public class UIEventManager : Singleton<UIEventManager>
{
    Dictionary<UIEventName, UIEvent> eventDictionary = new Dictionary<UIEventName, UIEvent>();
	
    public void RegistEventHandler(UIEventName eventName, UIEvent eventHandler)
    {
        eventDictionary[eventName] = eventHandler;
    }

    public void UnRegistEventHandler(UIEventName eventName)
    {
        if(eventDictionary.ContainsKey(eventName))
        {
            eventDictionary.Remove(eventName);
        }
    }

    public void SendEvent(UIEventName eventName, params object[] allParams)
    {
        if(eventDictionary.ContainsKey(eventName))
        {
            eventDictionary[eventName](allParams);
        }
    }

}
